<?php /*a:2:{s:67:"/www/wwwroot/jj.xueao400.com/application/jujin/view/member/add.html";i:1541589680;s:71:"/www/wwwroot/jj.xueao400.com/application/admin/view/public/content.html";i:1531908558;}*/ ?>
<!-- 右则内容区域 开始 -->

<div class="layui-card">
    <!--<?php if(!(empty($title) || (($title instanceof \think\Collection || $title instanceof \think\Paginator ) && $title->isEmpty()))): ?>-->
    <div class="layui-header notselect">
        <div class="pull-left"><span><?php echo htmlentities($title); ?></span></div>
        <div class="pull-right margin-right-15 nowrap"></div>
    </div>
    <!--<?php endif; ?>-->
    <div class="layui-card-body">
<form autocomplete="off" onsubmit="return false;" action="<?php echo request()->url(); ?>" data-auto="true" method="post" class='form-horizontal layui-form padding-top-20'>

    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
        <ul class="layui-tab-title">
            <li class="layui-this">基本信息</li>
            <?php if($type == USER_TYPE_WORKER): ?>
            <li>工人邦信息</li>
            <?php endif; if($type == USER_TYPE_SUPPLIER): ?>
            <li>供应商信息</li>
            <?php endif; ?>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <div class="form-group">
                    <label class="col-sm-2 control-label">手机号</label>
                    <div class='col-sm-8'>
                        <input autofocus name="phone" value='' required="required" title="请输入手机号" placeholder="请输入手机号" class="layui-input">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">昵称</label>
                    <div class='col-sm-8'>
                        <input name="nickname" value='' required="required" title="请输入昵称" placeholder="请输入昵称" class="layui-input">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">标签</label>
                    <div class='col-sm-8'>
                        <?php $flag_arr = FLAG_ARR; foreach($flag_arr as $flag_key=>$flag): ?>
                        <label class="think-checkbox"><input lay-ignore class="list-check-box" type="checkbox" <?php if(in_array(($flag_key), explode(',',""))): ?>checked<?php endif; ?> value="<?php echo htmlentities($flag_key); ?>" name="flag[]"/> <?php echo htmlentities($flag); ?></label>
                        <?php endforeach; ?>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">性别</label>
                    <div class='col-sm-8'>
                        <label class="think-radio"><input lay-ignore type="radio" checked value="男" name="sex"/> 男</label>
                        <label class="think-radio"><input lay-ignore type="radio"  value="女" name="sex"/> 女</label>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">位置</label>
                    <div class='col-sm-2'>
                        <select name="province" id="province" lay-filter="province">
                            <option value="0">请选择</option>
                        </select>
                    </div>
                    <div class='col-sm-2'>
                        <select name="city" id="city" lay-filter="city">
                            <option value="0">请选择</option>
                        </select>
                    </div>
                    <div class='col-sm-2'>
                        <select name="area" id="area" lay-filter="area">
                            <option value="0">请选择</option>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">详细地址</label>
                    <div class='col-sm-8'>
                        <input value="" class="layui-input" name="address">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">排序</label>
                    <div class='col-sm-8'>
                        <input value="0" class="layui-input" name="sort">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label label-required">会员头像</label>
                    <div class='col-sm-8'>
                        <table class="layui-table background-item margin-none" lay-size="sm" lay-skin="nob">
                            <thead>
                            <tr>
                                <td>会员头像</td>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td class="text-top" style="width:100px">
                                    <input type="hidden" name="headimg" value="">
                                    <script>$('[name=headimg]').uploadOneImage()</script>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="layui-tab-item">
                <!--工人邦信息-->
                <?php if($type == USER_TYPE_WORKER): ?>

                <div class="form-group">
                    <label class="col-sm-2 control-label">姓名</label>
                    <div class='col-sm-8'>
                        <input name="name" value='' required="required" title="请输入姓名" placeholder="请输入姓名" class="layui-input">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">工种</label>
                    <div class='col-sm-8'>
                        <label class="layui-input no_border">
                            <?php foreach($my_cate as $cate): ?>
                            <label class="think-checkbox"><input lay-ignore class="list-check-box onecate" type="checkbox"  value="<?php echo htmlentities($cate['id']); ?>" name="onecate[]"/> <?php echo htmlentities($cate['title']); ?></label>
                            <?php endforeach; ?>
                        </label>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">技能</label>
                    <div class='col-sm-8'>
                        <label class="layui-input no_border">
                            <?php foreach($my_cate as $cate): foreach($cate['_child'] as $item): ?>
                            <label class="think-checkbox" style="display: none;"><input lay-ignore class="list-check-box twocate" type="checkbox"  value="<?php echo htmlentities($item['id']); ?>" name="twocate[]" data="<?php echo htmlentities($item['pid']); ?>"/> <?php echo htmlentities($item['title']); ?></label>
                            <?php endforeach; endforeach; ?>
                        </label>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">工价</label>
                    <div class='col-sm-8'>
                        <input type="number" step="0.01" name="work_price" value='' required="required" title="请输入工价" placeholder="0.00" class="layui-input">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">生日</label>
                    <div class='col-sm-8'>
                        <input name="birthday" value='' required="required" title="请选择生日" placeholder="请选择生日" class="layui-input">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">个人擅长</label>
                    <div class='col-sm-8'>
                        <input name="good_at" value='' required="required" title="请输入个人擅长" placeholder="请输入个人擅长" class="layui-input">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">过期时间</label>
                    <div class='col-sm-8'>
                        <input name="expiry_time" value="" required="required" title="请选择过期时间" placeholder="请选择过期时间" class="layui-input">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">入驻等级</label>
                    <div class='col-sm-8'>
                        <select required class="layui-select full-width" name="grade_id">
                            <?php foreach($store_member_grade as $grade): ?>
                            <option  value="<?php echo htmlentities($grade['id']); ?>"><?php echo htmlentities($grade['name']); ?></option>
                            <?php endforeach; ?>
                        </select>
                    </div>
                </div>
                <?php endif; ?>
                <!--供应商信息-->
                <?php if($type == USER_TYPE_SUPPLIER): ?>

                <div class="form-group">
                    <label class="col-sm-2 control-label">供应商名称</label>
                    <div class='col-sm-8'>
                        <input name="name" value='' required="required" title="请输入供应商名称" placeholder="请输入供应商名称" class="layui-input">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">座机号</label>
                    <div class='col-sm-8'>
                        <input name="tel" value='' required="required" title="请输入座机号" placeholder="请输入座机号" class="layui-input">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">企业概况</label>
                    <div class='col-sm-8'>
                        <textarea class="layui-textarea" name="intro" placeholder="请输入企业概况"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label label-required">简介图片</label>
                    <div class='col-sm-8'>
                        <table class="layui-table background-item margin-none" lay-size="sm" lay-skin="nob">
                            <thead>
                            <tr>
                                <td>图片</td>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td class="text-top">
                                    <input type="hidden" name="images" value="<?php echo htmlentities((isset($vo['images']) && ($vo['images'] !== '')?$vo['images']:'')); ?>">
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <script>
                    $('input[name="images"]').uploadMultipleImage();
                </script>
                <div class="form-group">
                    <label class="col-sm-2 control-label">从事行业</label>
                    <div class='col-sm-8'>
                        <label class="layui-input no_border" style="height: auto;">
                            <?php foreach($my_cate as $cate): ?>
                            <label class="think-checkbox"><input lay-ignore class="list-check-box onecate" type="checkbox"  value="<?php echo htmlentities($cate['id']); ?>" name="onecate[]"/> <?php echo htmlentities($cate['title']); ?></label>
                            <?php endforeach; ?>
                        </label>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">主营范围</label>
                    <div class='col-sm-8'>
                        <label class="layui-input no_border">
                            <?php foreach($my_cate as $cate): foreach($cate['_child'] as $item): ?>
                            <label class="think-checkbox" style="display: none;"><input lay-ignore class="list-check-box twocate" type="checkbox"  value="<?php echo htmlentities($item['id']); ?>" name="twocate[]" data="<?php echo htmlentities($item['pid']); ?>"/> <?php echo htmlentities($item['title']); ?></label>
                            <?php endforeach; endforeach; ?>
                        </label>
                    </div>
                </div>

                <!--<div class="form-group">
                    <label class="col-sm-2 control-label label-required">经典案例</label>
                    <div class='col-sm-8'>
                        <table class="layui-table background-item margin-none" lay-size="sm" lay-skin="nob">
                            <thead>
                            <tr>
                                <td>案例图片</td>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td class="text-top">
                                    <input type="hidden" name="case" value="<?php echo htmlentities((isset($vo['supplier_info']['case']) && ($vo['supplier_info']['case'] !== '')?$vo['supplier_info']['case']:'')); ?>">
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <script>
                    $('input[name="case"]').uploadMultipleImage();
                </script>-->

                <div class="form-group">
                    <label class="col-sm-2 control-label">过期时间</label>
                    <div class='col-sm-8'>
                        <input name="expiry_time" value="" required="required" title="请选择过期时间" placeholder="请选择过期时间" class="layui-input">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">入驻等级</label>
                    <div class='col-sm-8'>
                        <select required class="layui-select full-width" name="grade_id">
                            <?php foreach($store_member_grade as $grade): ?>
                            <option value="<?php echo htmlentities($grade['id']); ?>"><?php echo htmlentities($grade['name']); ?></option>
                            <?php endforeach; ?>
                        </select>
                    </div>
                </div>
                <?php endif; ?>
            </div>
        </div>
    </div>

    <div class="hr-line-dashed"></div>

    <div class="col-sm-7 col-sm-offset-2">
        <div class="layui-form-item text-center">
            <input type="hidden" value="<?php echo htmlentities($type); ?>" name="type">
            <button class="layui-btn" type="submit">保存</button>
            <button class="layui-btn layui-btn-danger" type='button' onclick="window.history.back()">取消</button>
        </div>
    </div>

    <style>
        .background-item {
            padding: 15px;
            background: #efefef;
        }
        .no_border{border:none;}
        .background-item thead tr {
            background: #e0e0e0
        }
    </style>
    <script>
        window.form.render();
        layui.use('laydate', function(){
            var laydate = layui.laydate;

            laydate.render({
                elem: 'input[name=birthday]',
                btns: ['now', 'confirm']
            });
            laydate.render({
                elem: 'input[name=expiry_time]',
                type: 'datetime',
                btns: ['now', 'confirm']
            });
        });
        $(document).ready(function(){
            console.log('ready')
            $(".onecate").change(function () {
                    console.log($(this).val())
                    var that = this
                    if($(this).is(':checked') == true){
                        $(".twocate").each(function (index,element) {
                            if($(element).attr('data') == $(that).val()){
                                //$(element).attr("checked",false);
                                $(element).parent().show()
                            }
                        })
                    }else{
                        $(".twocate").each(function (index,element) {
                            if($(element).attr('data') == $(that).val()){
                                $(element).attr("checked",false);
                                $(element).parent().hide()
                            }
                        })
                    }
                })
            $.post("<?php echo url('jujin/city/getlists'); ?>",function (res) {
                if(typeof res === 'object'){
                    $.each( res.data, function( key, val ) {
                        $("#province").append('<option value="'+val.id+'">'+val.name+'</option>')
                    });
                    form.render('select');
                }
            })
            form.on('select(province)', function(data){
                $("#city").empty()
                $("#city").append('<option value="0">请选择</option>')
                $("#area").empty()
                $("#area").append('<option value="0">请选择</option>')
                if(data.value == 0){
                    form.render('select');
                    return false
                }
                $.post("<?php echo url('jujin/city/getlists'); ?>",{pid:data.value},function (res) {
                    if(typeof res === 'object'){
                        $.each( res.data, function( key, val ) {
                            $("#city").append('<option value="'+val.id+'">'+val.name+'</option>')
                        });
                        form.render('select');
                    }
                })
            });
            form.on('select(city)', function(data){
                $("#area").empty()
                $("#area").append('<option value="0">请选择</option>')
                if(data.value == 0){
                    form.render('select');
                    return false
                }
                $.post("<?php echo url('jujin/city/getlists'); ?>",{pid:data.value},function (res) {
                    if(typeof res === 'object'){
                        $.each( res.data, function( key, val ) {
                            $("#area").append('<option value="'+val.id+'">'+val.name+'</option>')
                        });
                        form.render('select');
                    }
                })
            });
        });
    </script>
</form>
</div>
</div>

<!-- 右则内容区域 结束 -->